package com.lpb.spring.lpbspring.aop.advisor;

import com.lpb.spring.lpbspring.aop.pointcut.AspectJExpressionPointcut;
import com.lpb.spring.lpbspring.aop.pointcut.Pointcut;

/**
 * @ClassName AspectJPointcutAdvisor
 * @Description aspectJ 类型的切点切面类，
 *              与之相对的还有正则匹配类型的切点切面类
 *         这是切面的具体实现，一个切面有具体的通知和切点
 * @date 2022/12/5 22:50
 * @Version 1.0
 * @authoe linpengbo
 */
public class AspectJPointcutAdvisor implements PointcutAdvisor{

    private String adviceBeanName;

    private String expression;

    private AspectJExpressionPointcut pointcut;

    public AspectJPointcutAdvisor(String adviceBeanName,String expression){
        this.adviceBeanName=adviceBeanName;
        this.expression=expression;
        this.pointcut=new AspectJExpressionPointcut(expression);
    }


    @Override
    public String getAdviceBeanName() throws Exception {
        return this.adviceBeanName;
    }

    @Override
    public String getExpression() throws Exception {
        return this.expression;
    }

    @Override
    public Pointcut getPointcut() throws Exception {
        return this.pointcut;
    }
}
